package kr.saeildamil.androidforstudy2.ch2930;

import android.app.Service;
import android.content.Intent;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.os.Messenger;
import android.widget.Toast;

public class MessengerService extends Service {

	@Override
	public IBinder onBind(Intent intent) {
		return mMessenger.getBinder();
	}

	Messenger mMessenger = new Messenger(new Handler(){
		public void handleMessage(Message msg) {
			super.handleMessage(msg);
			if(msg.what == 0){
				Toast.makeText(MessengerService.this, "Hi!", Toast.LENGTH_SHORT).show();
			}
		};
	});
}
